package com.qt.thread.threadpool;

import java.util.Hashtable;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Author zsf
 * @Date 2023/10/4 19:50
 * @Version 1.0
 */
public class MyThreadPool {

    public static void main(String[] args) {


        ExecutorService executorService1 = Executors.newCachedThreadPool();
        ExecutorService executorService = Executors.newFixedThreadPool(10);

        ThreadPoolExecutor tp = new ThreadPoolExecutor(
                3,
                6,
                60,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(3),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy()//拒绝策略： 内部类是依赖外部类存在的； 内部类是一个独立的个体
        );


        //向Java虚揶如返回可用处理器的数目
        int count = Runtime.getRuntime().availableProcessors();
        System.out.println(count);


        AtomicInteger atomicInteger = new AtomicInteger(0);
        atomicInteger.incrementAndGet();

        new ConcurrentHashMap<>();


    }

}
